package com.fancy.learncenter.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.fancy.learncenter.activity.ToothDetailsActivity;
import com.fancy.learncenter.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.adapter.base.CustomViewHold;
import com.fancy.learncenter.bean.CollectDataBean;
import com.fancy.learncenter.bean.WDListDataBean;
import com.superservice.lya.R;

import java.util.ArrayList;

/**
 * Created by hyy on 2018/1/27.
 * Explain activity as
 */

public class ToothCollectWDAdapter extends CommonRecycleViewAdapter<CollectDataBean> {

    public ToothCollectWDAdapter(Context mContext, ArrayList<CollectDataBean> itemDatas) {
        super(mContext, R.layout.fragment_tooth_wd_item, itemDatas);
    }

    @Override
    public void bindView(CustomViewHold customViewHold, final CollectDataBean item, int position) {

        SimpleDraweeView user_icon = customViewHold.getView(R.id.user_icon);
        user_icon.setImageURI(item.getImgsrc());

        TextView userName = customViewHold.getView(R.id.userName);
        userName.setText(item.getNick_name());

        TextView qustion = customViewHold.getView(R.id.qustion);
        qustion.setText(item.getTitle());

        TextView question_num = customViewHold.getView(R.id.question_num);
        question_num.setText(item.getComment_num() + "人回答");

        TextView time = customViewHold.getView(R.id.time);
        time.setText(item.getAdd_time() + "发布");

        TextView flag1 = customViewHold.getView(R.id.flag1);

        TextView islove = customViewHold.getView(R.id.islove);


        SimpleDraweeView answer_icon = customViewHold.getView(R.id.answer_icon);
//        if (item.getIs_solve().equals("1")) {
//            flag1.setText("已解决");
//            islove.setVisibility(View.VISIBLE);
//            islove.setText(item.getSolve().getContent());
//
//            answer_icon.setVisibility(View.VISIBLE);
//            answer_icon.setImageURI(item.getSolve().getComment_user_img());
//        } else {
//            flag1.setText("问.未解决");
//            islove.setVisibility(View.GONE);
//
//            answer_icon.setVisibility(View.GONE);
//        }

        customViewHold.getRoorView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, ToothDetailsActivity.class);
                intent.putExtra("wdListDataBean", item.getId());
                mContext.startActivity(intent);
            }
        });
    }
}
